//
// Created by yinlixing on 2024/7/4.
//

#ifndef AXCEED210_MATE_FIRMWARE_RINGBUFFER_H
#define AXCEED210_MATE_FIRMWARE_RINGBUFFER_H

#ifdef __cplusplus
extern "C" {
#endif

typedef struct {
    void*   _buffer;
    int     _pHead;
    int     _pTail;
    int     _pWrite;
    int     _pRead;
    int     _unit_size;
    int     _is_full;
}rb_control;

int rb_init(rb_control* control, void* buffer, int buffer_size, int unit_size);
void rb_reset(rb_control* control);
void* rb_get_write_buf(rb_control* control);
void* rb_get_read_buf(rb_control* control);
int rb_is_readable(rb_control* control);
int rb_is_writeable(rb_control* control);

#ifdef __cplusplus
}
#endif

#endif //AXCEED210_MATE_FIRMWARE_RINGBUFFER_H
